package com.林子祺.CAT旅游系统.controller.contentmanagement;

import com.林子祺.CAT旅游系统.dao.placemanagement.PlacePull;
import com.林子祺.CAT旅游系统.entity.place.CurrentPlaceData;
import com.林子祺.CAT旅游系统.entity.place.PlaceData;
import com.林子祺.CAT旅游系统.view.Recommend;

import java.awt.*;
import java.util.Random;

public class RecommendShow {

    public static void get(){
        PlaceData.Refresh();
        PlacePull.pull();
        Random r = new Random();
        int selected = r.nextInt(PlaceData.pd.size());
        CurrentPlaceData.id = PlaceData.pd.get(selected).getId();
        CurrentPlaceData.name = PlaceData.pd.get(selected).getName();
        CurrentPlaceData.price = PlaceData.pd.get(selected).getPrice();
        CurrentPlaceData.provience = PlaceData.pd.get(selected).getProvience();
        CurrentPlaceData.city = PlaceData.pd.get(selected).getCity();
        CurrentPlaceData.address = PlaceData.pd.get(selected).getAddress();
        CurrentPlaceData.detail = PlaceData.pd.get(selected).getDetail();
        try {
            Recommend.show();
        } catch (AWTException e) {
            throw new RuntimeException(e);
        }
    }

}
